#include <iostream>
#include <cmath>

class point
{
public:
    double value = 0;
    double x = 0, y = 0;
    int whether_in_disk = 0;
    point() {}
    point(double _x, double _y) : x(_x), y(_y) {}

    void set(double _x, double _y)
    {
        x = _x;
        y = _y;
    }

    double getx()
    {
        return x;
    }

    double gety()
    {
        return y;
    }

    bool operator==(point _p)
    {
        if (fabs(_p.getx() - x) > 1e-12)
            return false;
        if (fabs(_p.gety() - y) > 1e-12)
            return false;
        return true;
    }

    double distance(point _p) // 两点之间距离
    {
        double dis_x = abs(x - _p.x);
        double dis_y = abs(y - _p.y);
        if (dis_x == 0 || dis_y == 0)
            return dis_x + dis_y;
        else
            return sqrt(pow(dis_x, 2) + pow(dis_y, 2));
    }
};

class Coordinate {
public:
    Coordinate(){}
    Coordinate(double x, double y) : x_(x), y_(y) {}

    void move(int dx, int dy) {
        x_ += dx;
        y_ += dy;
    }

    double distance(const Coordinate& other) const {
        int dx = x_ - other.x_;
        int dy = y_ - other.y_;
        return std::sqrt(dx * dx + dy * dy);
    }

    friend std::ostream& operator<<(std::ostream& os, const Coordinate& coord);

private:
    int x_, y_;
    point tmp(0.5, 0.5);
};

std::ostream& operator<<(std::ostream& os, const Coordinate& coord) {
    os << "(" << coord.x_ << ", " << coord.y_ << ")";
    return os;
}
int main() {
    Coordinate a(0.5, 0.5);
    Coordinate b;
    point tmp(0.5,0.5);
    std::cout << a << std::endl;  // 输出：(3, 4)
    std::cout << b.distance(a) << std::endl;  // 输出：5

    a.move(-1, 2);
    std::cout << a << std::endl;  // 输出：(2, 6)

    return 0;
}
